from user.models import User
from technology.models import Technology, Know


def user_add_technology(user, technology):
    assert isinstance(user, User)
    assert isinstance(technology, Technology)
    know = Know(uid=user, tid=technology)
    know.save()
    return know


def user_delete_technology(user, technology):
    assert isinstance(user, User)
    assert isinstance(technology, Technology)
    know = Know.objects.get(uid=user, tid=technology)
    tid = know.tid_id
    know.delete()
    return tid
